
import { defineConfig } from 'vite';
import vue from '@vitejs/plugin-vue'
import Components from 'unplugin-vue-components/vite'
import{ VantResolver } from 'unplugin-vue-components/resolvers';

import postCssPxToRem from 'postcss-pxtorem'

import path from 'path'
function _resolve(dir){
  return path.resolve(__dirname,dir);
}

// https://vitejs.dev/config/
export default defineConfig({
  plugins: [
    vue(),
    Components({
      resolves: [VantResolver()],
    }),
  ],
  resolve:{
    alias:{
      '@':_resolve('src')
    }
  },
  css:{
    postcss:{
      plugins:[
        postCssPxToRem({
          rootValue:37.5,
          propList:['*'],
          selectorBlackList:[".norem"]
        })
      ]
    },
    preprocessorOptions:{
      scss:{
        additionalData:"@import '@/assets/styles/variables.scss';"
      },
      // less: {
      //   javascriptEnabled: true,
      // }  
    }
  }
})
